package com.paginasenlanube.dao;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.paginasenlanube.model.Website;


@Repository("websiteDao")
public class WebsiteDaoImpl {

	@Autowired
	@Qualifier("hibernateDao")
	private GenericDao dao;
	
	public GenericDao getDao() {
		return dao;
	}
	

	public Website getWebsiteById(long websiteId) {
		
		Website wbs = dao.getObjectById(Website.class, websiteId);
		System.out.println("id:"+wbs.getId());
		return wbs;
		
	}
	
	

	public List<Website> getWebsitesByUserId(long userId) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("user_id", userId);
		List<Website> wbs = dao.getObjectsByEqCriteria(Website.class, params, null);		
		return wbs;
		
	}


}
